public class Code2 {

    public static void main(String[] args) {

        int num;
        for(int i=2; i<=1000; i++){
            num = 0;
            for(int j=1; j<=i/2; j++){
                if(0 == i%j){
                    num += j;
                }
            }
            if(i == num){
                System.out.println(i);
            }
        }
    }
}
